package com.apes.fn.scm.retailOrder.service.tc.vipSurplus;

/**
 * @Title: VipSurplusFormula
 * @Description: 会员联盟结算明细公式
 * @author: ZhengZeXian
 * @create: 2021/8/27 9:52
 */
public class VipSurplusFormula {

    /** 老系统会员联盟结算明细-收款-结算金额*/
    protected static final String OLD_VIP_SURPLUS_SK_JSJE = "double JSJE = 0;\n" +
            "                        if (SKFSID=='15'){\n" +
            "                            JSJE = SYJE*T011;\n" +
            "                        }\n" +
            "                        if (SKFSID=='05'){\n" +
            "                            JSJE = SYJE*T021;\n" +
            "                        }\n" +
            "\n" +
            "                        if(DJLXID == 'XT1'){\n" +
            "                            return JSJE* -1;\n" +
            "                        }\n" +
            "                        return JSJE;";

    /** 老系统会员联盟结算明细-商品-抵扣类型*/
    protected static final String OLD_VIP_SURPLUS_SP_DKLX = "if(DJLXID == 'XT1'){\n" +
            "                             return YDKLX;\n" +
            "                         }\n" +
            "                        if(DKLX ==null){\n" +
            "                            return 0;\n" +
            "                        }\n" +
            "\n" +
            "                        if(DKLX ==1){\n" +
            "                            return 0;\n" +
            "                        }\n" +
            "\n" +
            "                        if(DKLX ==2){\n" +
            "                            return 1;\n" +
            "                        }";

    /** 老系统会员联盟结算明细-商品-红包抵扣金额*/
    protected static final String OLD_VIP_SURPLUS_SP_DKJE = "if(CXFSLB==4 && HBLX !=1) {\n" +
            "                            return DKJE;\n" +
            "                        } else {\n" +
            "                         return 0;\n" +
            "                        }";

    /** 老系统会员联盟结算明细-商品-保呗红包抵扣金额*/
    protected static final String OLD_VIP_SURPLUS_SP_BBDKJE = "if(CXFSLB==4  && HBLX ==1) {\n" +
            "                            return DKJE;\n" +
            "                        } else {\n" +
            "                         return 0;\n" +
            "                        }";

    /** 老系统会员联盟结算明细-商品-返现抵扣金额*/
    protected static final String OLD_VIP_SURPLUS_SP_FXJE = "if(CXFSLB==2) {\n" +
            "                            return DKJE;\n" +
            "                        } else {\n" +
            "                         return 0;\n" +
            "                        }";

    /** 老系统会员联盟结算明细-商品-抵扣结算金额*/
    protected static final String OLD_VIP_SURPLUS_SP_DKJSJE = "if (CXFSLB == 4 && HBLX !=1) {\n" +
            "                            return DKJE  * T022;\n" +
            "                        }\n" +
            "                        return 0;";
    /** 老系统会员联盟结算明细-商品-保呗抵扣结算金额*/
    protected static final String OLD_VIP_SURPLUS_SP_BBJSJE = "if (CXFSLB == 4 && HBLX ==1) {\n" +
            "                            return BBDKJE  * T024;\n" +
            "                        }\n" +
            "                        return 0;";

    /** 老系统会员联盟结算明细-商品-返现结算金额*/
    protected static final String OLD_VIP_SURPLUS_SP_FXJSJE = "if (CXFSLB == 2) {\n" +
            "                            return DKJE  * T022;\n" +
            "                        }\n" +
            "\n" +
            "                        return 0;";

    /** 老系统会员联盟结算明细-商品-兑换券结算金额*/
    protected static final String OLD_VIP_SURPLUS_SP_DHQJSJE = "if(DJLXID == 'XT1'){\n" +
            "                            if (CXFSLB == 0) {\n" +
            "                                if (T001!=null){\n" +
            "                                    return T001 * -1 ;\n" +
            "                                }\n" +
            "                                if (T002!=0){\n" +
            "                                    return T002 * -1;\n" +
            "                                }\n" +
            "                                if (T003!=0){\n" +
            "                                    if (SUB_CLASS =='M'){\n" +
            "                                         return CBJ * T003 * -1;\n" +
            "                                    }\n" +
            "                                    if (SUB_CLASS =='S'){\n" +
            "                                        return DSJ * T003 * -1;\n" +
            "                                    }\n" +
            "                                }\n" +
            "                                if (SUB_CLASS =='M'){\n" +
            "                                     return CBJ * T012 * -1;\n" +
            "                                }\n" +
            "                                if (SUB_CLASS =='S'){\n" +
            "                                     return DSJ * T023 * -1;\n" +
            "                                }\n" +
            "                            }\n" +
            "                         }\n" +
            "                         if (CXFSLB == 0) {\n" +
            "                            if (T001!=null){\n" +
            "                                return T001 ;\n" +
            "                            }\n" +
            "                            if (T002!=0){\n" +
            "                                return T002 ;\n" +
            "                            }\n" +
            "                            if (T003!=0){\n" +
            "                                if (SUB_CLASS =='M'){\n" +
            "                                     return CBJ * T003;\n" +
            "                                }\n" +
            "                                if (SUB_CLASS =='S'){\n" +
            "                                    return DSJ * T003;\n" +
            "                                }\n" +
            "                            }\n" +
            "                            if (SUB_CLASS =='M'){\n" +
            "                                 return CBJ * T012;\n" +
            "                            }\n" +
            "                            if (SUB_CLASS =='S'){\n" +
            "                                 return DSJ * T023;\n" +
            "                            }\n" +
            "                        }";

    /** 新系统会员联盟结算明细-收款-结算金额*/
    protected static final String NEW_VIP_SURPLUS_SK_JSJE = "double JSJE = 0;\n" +
            "                        if (SKFSID=='15'){\n" +
            "                            JSJE = SYJE*T011;\n" +
            "                        }\n" +
            "                        if (SKFSID=='05'){\n" +
            "                            JSJE = SYJE*T021;\n" +
            "                        }\n" +
            "\n" +
            "                        if(DJLXID == 'retailReturn'){\n" +
            "                            return JSJE* -1;\n" +
            "                        }\n" +
            "                        return JSJE;";

    /** 新系统会员联盟结算明细-商品-抵扣类型*/
    protected static final String NEW_VIP_SURPLUS_SP_DKLX = "if(DJLXID == 'retailReturn'){\n" +
            "                           return YDKLX;\n" +
            "                        }\n" +
            "                        if(DKLX ==null){\n" +
            "                            return 0;\n" +
            "                        }\n" +
            "\n" +
            "                        if(DKLX ==1){\n" +
            "                            return 0;\n" +
            "                        }\n" +
            "\n" +
            "                        if(DKLX ==2){\n" +
            "                            return 1;\n" +
            "                        }";

    /** 新系统会员联盟结算明细-商品-红包抵扣金额*/
    protected static final String NEW_VIP_SURPLUS_SP_DKJE = "if(CXFSLB=='001598' && HBLX=='0') {\n" +
            "                            return DKJE;\n" +
            "                        } else {\n" +
            "                            return 0;\n" +
            "                        }";
    /** 新系统会员联盟结算明细-商品-保呗红包抵扣金额*/
    protected static final String NEW_VIP_SURPLUS_SP_BBDKJE = "if(CXFSLB=='001598' && HBLX=='1') {\n" +
            "                            return DKJE;\n" +
            "                        } else {\n" +
            "                            return 0;\n" +
            "                        }";

    /** 新系统会员联盟结算明细-商品-返现抵扣金额*/
    protected static final String NEW_VIP_SURPLUS_SP_FXJE = "if(CXFSLB=='001602') {\n" +
            "                            return DKJE;\n" +
            "                        } else {\n" +
            "                            return 0;\n" +
            "                        }";

    /** 新系统会员联盟结算明细-商品-抵扣结算金额*/
    protected static final String NEW_VIP_SURPLUS_SP_DKJSJE = "if (CXFSLB == '001598' && HBLX=='0') {\n" +
            "                              if(DJLXID == 'retailReturn'){\n" +
            "                                   return DKJE  * T022;\n" +
            "                              }\n" +
            "                            return DKJE  * T022;\n" +
            "                        }\n" +
            "\n" +
            "                        return 0;";
    /** 新系统会员联盟结算明细-商品-抵扣结算金额*/
    protected static final String NEW_VIP_SURPLUS_SP_BBJSJE = "if (CXFSLB == '001598' && HBLX=='1') {\n" +
            "                              if(DJLXID == 'retailReturn'){\n" +
            "                                   return BBDKJE  * T024;\n" +
            "                              }\n" +
            "                            return BBDKJE  * T024;\n" +
            "                        }\n" +
            "\n" +
            "                        return 0;";

    /** 新系统会员联盟结算明细-商品-返现结算金额*/
    protected static final String NEW_VIP_SURPLUS_SP_FXJSJE = "if (CXFSLB == '001602' ) {\n" +
            "                            if(DJLXID == 'retailReturn'){\n" +
            "                                   return DKJE  * T022;\n" +
            "                             }\n" +
            "                            return DKJE  * T022;\n" +
            "                        }\n" +
            "                        return 0;";

    /** 老系统会员联盟结算明细-商品-兑换券结算金额*/
    protected static final String NEW_VIP_SURPLUS_SP_DHQJSJE = "if(DJLXID == 'retailReturn'){\n" +
            "                            if (CXFSLB == '001600' ) {\n" +
            "                                if (T001!=null){\n" +
            "                                    return T001 * -1;\n" +
            "                                }\n" +
            "                                if (T002!=0){\n" +
            "                                    return T002 * -1;\n" +
            "                                }\n" +
            "                                if (T003!=0){\n" +
            "                                    if (SUB_CLASS =='M'){\n" +
            "                                        return CBJ * T003 * -1;\n" +
            "                                    }\n" +
            "                                    if (SUB_CLASS =='S'){\n" +
            "                                        return DSJ * T003 * -1;\n" +
            "                                    }\n" +
            "                                }\n" +
            "                                if (SUB_CLASS =='M'){\n" +
            "                                    return CBJ * T012 * -1;\n" +
            "                                }\n" +
            "                                if (SUB_CLASS =='S'){\n" +
            "                                    return DSJ * T023 * -1;\n" +
            "                                }\n" +
            "                            }\n" +
            "                         }\n" +
            "                         if (CXFSLB == '001600' ) {\n" +
            "                            if (T001!=null){\n" +
            "                                return T001 ;\n" +
            "                            }\n" +
            "                            if (T002!=0){\n" +
            "                                return T002 ;\n" +
            "                            }\n" +
            "                            if (T003!=0){\n" +
            "                                if (SUB_CLASS =='M'){\n" +
            "                                    return CBJ * T003;\n" +
            "                                }\n" +
            "                                if (SUB_CLASS =='S'){\n" +
            "                                    return DSJ * T003;\n" +
            "                                }\n" +
            "                            }\n" +
            "                            if (SUB_CLASS =='M'){\n" +
            "                                return CBJ * T012;\n" +
            "                            }\n" +
            "                            if (SUB_CLASS =='S'){\n" +
            "                                return DSJ * T023;\n" +
            "                            }\n" +
            "                        }";
}
